<%@ page language="java" pageEncoding="utf-8"%>
<%@ page import="java.util.*;" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>preview.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<LINK href="../styles/stylewang.css"  type=text/css rel=stylesheet>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script language=javascript>
		var width;
		var height;
		function filter(){
			var fileframe=document.getElementById("fileframe").contentWindow;
			var bs=fileframe.document.getElementsByTagName("b");
			for(var i=0;i<bs.length;i++){
				var a=bs[i].nextSibling.nextSibling;
				var hr=a.innerHTML;
				if(checkIn(hr)){
					a.parentNode.parentNode.style.display="";
				}else{
					a.parentNode.parentNode.style.display="none";
				}
//				alert(hr);
			}
		}
		function checkIn(fileName){
			var flag=false;
			var filters=document.getElementsByName("filters");
			for(var j=0;j<filters.length;j++){
				if(filters[j].checked==true && fileName.indexOf(filters[j].value)!=-1){
					flag=true;
				}	
			}
			return flag;
		}
		function adaptImg(img){
			width=img.width;
			height=img.height;
			if(img.width*3>img.height*4){
				img.width=400;
			}else{
				img.height=300;
			}
		}
	</script>
  </head>
  
  <body>
 	<table cellspacing="0" cellpadding="0" width="100%">
       <tr><td colspan="2"></tr>
	<tr><td colspan="5" height="5"></td></tr>
    <tr valign="middle">
      <td width="7">&nbsp;</td>
      <td  width="400"class="leftbottom" id="imgTd"><img src="../imagewang/ep.jpg" onload="adaptImg(this);" id="previewImg" style="cursor:pointer;"></td>
      <logic:notEmpty name="path" >
    <td  class="leftbottom"><iframe id="fileframe" width="400" height="300" src="path/<bean:write name="path"/>?sort=dd&baseFlag=<bean:write name="baseFlag"/>" frameborder="0"></iframe></td>
   </logic:notEmpty > 
   <logic:empty name="path">
    <td  id="leftbottom">
    <iframe id="fileframe" width="400" height="300"  frameborder="0"></iframe></td>
   </logic:empty>
   	
    <td id="rightbottom">
    <form method="POST" action="">
		<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
		<%
			Set cateNames=(Set)request.getAttribute("cateNames");
			for(Iterator iter=cateNames.iterator();iter.hasNext();){
				String s=(String)iter.next();
		 %>
		<input type="checkbox" name="filters" checked value="<%=s %>"><%=s%><br>
		<%} %>
		<p>&nbsp;<input type="button" value="filter" onClick="filter();"></p>
	</form>    </td>
  </table>
  </body>
</html:html>